"""
URL configuration for keep_project0 project.

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/4.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
from tools.factory import OAuthUrlView, OAuthCallbackView

urlpatterns = [
    path('admin/', admin.site.urls),
    path('api/',include('user.urls')),
    path('user/',include('user.urls')),
    path('report/',include('report.urls')),
    path('verify/',include('verify.urls')),
    path('api/user/',include('user.urls')),
    path('course/',include('course.urls')),
    path('api/ai/',include('ai.urls')),
    path('api/diet/', include('diet.urls')),
    
    # OAuth工厂模式路由
    path('api/oauth/url/', OAuthUrlView.as_view(), name='oauth_url'),
    path('api/oauth/callback/', OAuthCallbackView.as_view(), name='oauth_callback'),
    path('user/dingdingCallback/', OAuthCallbackView.as_view(), name='dingding_callback'),
    path('api/gitee_callback/', OAuthCallbackView.as_view(), name='gitee_callback'),
]

# 添加媒体文件URL配置
if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
